package com.leapp.sk.ui.adapter

import android.content.Context
import com.example.mvp.adapter.BaseLibMultipleViewAdapter
import com.example.mvp.binder.BaseDataBinder
import com.example.mvp.delegate.BaseAdapterDelegate
import com.leapp.sk.bean.LevelEntity
import com.leapp.sk.binder.BaseBinder
import com.leapp.sk.viewdelegate.adapter.level.TeacherLeaveAdapterDelegate

/**
 * 老师端请假适配器
 * @author  chaohaipeng  on 2018/8/13.
 */
class TeacherLeaveAdapter (context: Context, mlist: List<LevelEntity>,isApproveds:Boolean) : BaseLibMultipleViewAdapter<LevelEntity>(context, mlist){

    /**
     * 数据
     */
    val mList = mlist
    /**
     * 上下文
     */
    val mContext = context
    /**
     * 是已审批
     */
    val isApproved = isApproveds
    override fun bindEvenListener(viewDelegate: BaseAdapterDelegate?, position: Int) {
    }

    override fun notifyView(viewDelegate: BaseAdapterDelegate?, position: Int) {
        val data = mList.get(position)
        if (viewDelegate is TeacherLeaveAdapterDelegate){
            viewDelegate.setData(data,isApproved)
        }

    }

    override fun getDelegate(position: Int): BaseAdapterDelegate {
        return  TeacherLeaveAdapterDelegate::class.java?.newInstance()
    }

    override fun getDataBinder(position: Int): BaseDataBinder<*, *> {
        return BaseBinder()
    }

    override fun getItemData(position: Int): Any {
       return mList.get(position)
    }



}